import request from "@/utils/http";
/**
 * 小程序登录
 * @param {string} encryptedData 加密的手机号信息 getphonenumber事件回调中获取
 * @param {string} iv 加密相关 getphonenumber事件回调中获取
 * @param {string} code 通过 wx.login() 获取
 */
export const loginByWXAPI = (data) => {
	return http({
	  url: "/login/wxMin",
	  method: "POST",
	  data,
	});
};
  
// 小程序登录-内测版
export const loginByTestPhoneAPI = (phoneNumber) => {
	return request({
	  url: "/login/wxMin/simple",
	  method: "post",
	  data: {
		phoneNumber,
	  },
	});
};
// 获取个人信息
export const getProfileAPI = () => {
	return request({
		url: `/member/profile`,
		
	});
}
// 修改个人信息
export const updateProfileAPI = (data) => {
	return request({
		url: "/member/profile",
		method: "put",
		data
	});
};
  
/** 上传头像 */
export const uploadPhotoAPI = (filePath) => {
	return uni.uploadFile({
	  url: "/member/profile/avatar",
	  // 💥💥 不需要写post
	  name: "file",
	  // 💥💥 注意参数是一个临时路径
	  filePath,
	});
  };